package com.dlc.beijingrfid.adapter;

import com.dlc.commonlibrary.adapter.BaseRecyclerAdapter;
import com.dlc.commonlibrary.utils.TimeFormats;
import com.dlc.beijingrfid.R;
import com.dlc.beijingrfid.net.bean.HandworkBean;

/**
 * Created by John on 2017/7/24.
 */

public class QuitHandworkAdapter extends BaseRecyclerAdapter<HandworkBean.DataBean> {
    private OnItemClickListener onItemClickListener;
    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.item_quit_handwork;
    }

    @Override
    public void onBindViewHolder(CommonHolder holder,final int position) {
        HandworkBean.DataBean item = getItem(position);
        holder.setText(R.id.serial, (position+1)+"");
        holder.setText(R.id.client, item.hotel);
        holder.setText(R.id.product_name, item.title);
        if (item.type.equals("1")) {
            holder.setText(R.id.shouxi_number, item.nums);
            holder.setText(R.id.songhuo_number, "");
        }else {
            holder.setText(R.id.shouxi_number, "");
            holder.setText(R.id.songhuo_number, item.nums);
        }
        holder.setText(R.id.time, TimeFormats.formatDateTime((long) Integer.parseInt(item.ctime) * 1000));


    }

    public interface OnItemClickListener {
        void onClick(int position);
    }
    public void setOnItemClickListener(OnItemClickListener onItemClickListener){
        this.onItemClickListener=onItemClickListener;

    }
}
